package com.rc.gongr.console;

import com.rc.gongr.worker.PostWorker;

import java.util.Scanner;

/**
 * This is the console interface for the gongr application. Will one day be the "back end" to gongr's web application.
 *
 * @author Andrew Bell
 */
public class MainGongrConsole {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PostWorker postWorker = new PostWorker();
        String comment = null;

        // Prompt user for input
        System.out.println("Gong Comment: ");
        // Accept user input
        try {
            comment = sc.nextLine();
        } catch (Exception e) {
            System.out.println("Invalid input: + " + e);
        }
        // Post user input
        try {
            postWorker.createGong(comment);
        } catch (Exception e) {
            System.out.println("Gong refused to post: " + e);
        }
        // Post success
        System.out.println(postWorker.getLastGong());
    }
}
